<?php

class MyController extends Controller
{

  public $masterPage = 'Default';

  public function IndexAction()
  {

    System::Web()->ScriptManager->js('calculator','/javascript/newjavascript.js');

    // Test model
    $user = new User();
    $user->id = 1;
    $user->guid = uniqid();
    $user->email = 'r.metlinskyi@gmail.com';
    $user->firstName = 'Roman';
    $user->lastName = 'Metlinskyi';
    $user->password = 'qwerty';

    return $this->View('index')
                ->Model($user)
                ->Render();
  }

  public function ErrorAction()
  {
    $model  = new Exception();

    return $this->View('index')
                ->Model($model)
                ->Render();
  }

  public function ReflectionAction()
  {

    $reflection = new ReflectionClass(HttpRequest);

    return $this->View('reflection')
                ->Model($reflection)
                ->Render();
  }

  public function RequestAction()
  {

    $model = My::System()->HttpRequest;

    $this->title = "Http method: " . $model->HttpMethod;

    return $this->View('request')
                ->Model($model)
                ->Render();
  }

  public function CommandAction()
  {
    return $this->View('command')
                ->Render();
  }
}